/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author riccardo
 */
@Entity
@Table(name = "CAMERA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Camera.findAll", query = "SELECT c FROM Camera c"),
    @NamedQuery(name = "Camera.findByIdCAMERA", query = "SELECT c FROM Camera c WHERE c.idCAMERA = :idCAMERA"),
    @NamedQuery(name = "Camera.findByPersone", query = "SELECT c FROM Camera c WHERE c.persone = :persone"),
    @NamedQuery(name = "Camera.findByIniziodisp", query = "SELECT c FROM Camera c WHERE c.iniziodisp = :iniziodisp"),
    @NamedQuery(name = "Camera.findByFinedisp", query = "SELECT c FROM Camera c WHERE c.finedisp = :finedisp"),
    @NamedQuery(name = "Camera.findByPrezzo", query = "SELECT c FROM Camera c WHERE c.prezzo = :prezzo"),
    @NamedQuery(name = "Camera.findByDescrizione", query = "SELECT c FROM Camera c WHERE c.descrizione = :descrizione")})
public class Camera implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idCAMERA")
    private Integer idCAMERA;
    @Basic(optional = false)
    @NotNull
    @Column(name = "persone")
    private int persone;
    @Basic(optional = false)
    @NotNull
    @Column(name = "iniziodisp")
    @Temporal(TemporalType.DATE)
    private Date iniziodisp;
    @Basic(optional = false)
    @NotNull
    @Column(name = "finedisp")
    @Temporal(TemporalType.DATE)
    private Date finedisp;
    @Basic(optional = false)
    @NotNull
    @Column(name = "prezzo")
    private int prezzo;
    @Size(max = 255)
    @Column(name = "descrizione")
    private String descrizione;
    @JoinColumn(name = "idHOTEL", referencedColumnName = "idHOTEL")
    @ManyToOne(optional = false)
    private Hotel idHOTEL;
    @JoinColumn(name = "idCAMERA", referencedColumnName = "idELEMENTO", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Elemento elemento;

    public Camera() {
    }

    public Camera(Integer idCAMERA) {
        this.idCAMERA = idCAMERA;
    }

    public Camera(Integer idCAMERA, int persone, Date iniziodisp, Date finedisp, int prezzo) {
        this.idCAMERA = idCAMERA;
        this.persone = persone;
        this.iniziodisp = iniziodisp;
        this.finedisp = finedisp;
        this.prezzo = prezzo;
    }

    public Integer getIdCAMERA() {
        return idCAMERA;
    }

    public void setIdCAMERA(Integer idCAMERA) {
        this.idCAMERA = idCAMERA;
    }

    public int getPersone() {
        return persone;
    }

    public void setPersone(int persone) {
        this.persone = persone;
    }

    public Date getIniziodisp() {
        return iniziodisp;
    }

    public void setIniziodisp(Date iniziodisp) {
        this.iniziodisp = iniziodisp;
    }

    public Date getFinedisp() {
        return finedisp;
    }

    public void setFinedisp(Date finedisp) {
        this.finedisp = finedisp;
    }

    public int getPrezzo() {
        return prezzo;
    }

    public void setPrezzo(int prezzo) {
        this.prezzo = prezzo;
    }

    public String getDescrizione() {
        return descrizione;
    }

    public void setDescrizione(String descrizione) {
        this.descrizione = descrizione;
    }

    public Hotel getIdHOTEL() {
        return idHOTEL;
    }

    public void setIdHOTEL(Hotel idHOTEL) {
        this.idHOTEL = idHOTEL;
    }

    public Elemento getElemento() {
        return elemento;
    }

    public void setElemento(Elemento elemento) {
        this.elemento = elemento;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCAMERA != null ? idCAMERA.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Camera)) {
            return false;
        }
        Camera other = (Camera) object;
        if ((this.idCAMERA == null && other.idCAMERA != null) || (this.idCAMERA != null && !this.idCAMERA.equals(other.idCAMERA))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Camera[ idCAMERA=" + idCAMERA + " ]";
    }
    
}
